import { uShowLoading, uHideLoading, uNavigateTo } from "@/utils/uniUtils.js";
export default {
  methods: {
    reachBtm(context) {
      console.log("onReachBottom");

      if (context.pageList.length < context.total) {
        context.showLoadMore = true;
        setTimeout(async () => {
          uShowLoading();
          await context.GetPageList();
          uHideLoading();
        }, 300);
      } else {
        return;
      }
    },

    async onTabClickEvent(e, context) {
      console.log("onTabClickEvent");
      context.tabMenusIdx = e.index;
      await context.GetPageList(e.index);
    },

    btnAddClickEvent(context) {
      uNavigateTo(
        `/pages/${context.rootRoute}/${context.routeName}/doEdit?mode=add `
      );
    },

    onItemClickEvent(item, context) {
      uNavigateTo(
        `/pages/${context.rootRoute}/${context.routeName}/doEdit?mode=edit&id=` +
          item.id
      );
    },

    async resetList() {
      this.pageList = [];
      this.pageNum = 1;
      await this.GetPageList();
    },

    // methods put on the top
  },
};
